package cn.itcast.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
//构建与索引库的关系以及索引库的结构
@Document(indexName="leyou",type = "goods",shards = 3,replicas = 1)
public class Goods implements Serializable {
    @Field(type = FieldType.Long)
    private Long id;
    @Field(type = FieldType.Text,analyzer = "ik_max_word",store = true)
    private String title; //标题
    //index默认为true
    @Field(type = FieldType.Keyword,index = true,store = true)
    private String category;// 分类,keyword不分词
    @Field(type = FieldType.Keyword,index = true,store = true)
    private String brand; // 品牌


    @Field(type = FieldType.Double,index = true,store = true)
    private Double price; // 价格
    @Field(type = FieldType.Keyword,index = false,store = true)
    private String images; // 图片地址
}
